package com.wanmait.houlang.service.impl;

import com.github.pagehelper.PageInfo;
import com.wanmait.houlang.mapper.ProfessionalCategoryMapper;
import com.wanmait.houlang.mapper.ProfessionalMapper;
import com.wanmait.houlang.pojo.Professional;
import com.wanmait.houlang.pojo.ProfessionalCategory;
import com.wanmait.houlang.service.ProfessionalCategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ProfessionalCategoryServiceImpl implements ProfessionalCategoryService {
    @Resource
    private ProfessionalCategoryMapper professionalCategoryMapper;
    @Resource
    private ProfessionalMapper professionalMapper;
    @Override
    public void insert(ProfessionalCategory object) {

    }

    @Override
    public void delete(Integer id) {

    }

    @Override
    public void delete(String ids) {

    }

    @Override
    public void update(ProfessionalCategory object) {

    }

    @Override
    public ProfessionalCategory findById(Integer id) {
        return null;
    }

    @Override
    public List<ProfessionalCategory> findAll() {
        List<ProfessionalCategory> categories = professionalCategoryMapper.findAll();
        List<Professional> professionals = professionalMapper.findAll();
        for(ProfessionalCategory category:categories){
            for(Professional professional:professionals){
                if (professional.getPid()==category.getId()){
                    category.getProfessionalList().add(professional);
                }
            }
        }
        return categories;
    }

    @Override
    public PageInfo<ProfessionalCategory> findAll(int pageNum, int pageSize, ProfessionalCategory object) {
        return null;
    }

}
